const state = {
  user: {
    name: '刘星铄',
    avatar: require('@/assets/default-avatar.png'),
    status: '空闲'
  },
  isAuthenticated: true
}

const mutations = {
  SET_USER(state, user) {
    state.user = user
  },
  SET_STATUS(state, status) {
    state.user.status = status
  },
  LOGOUT(state) {
    state.isAuthenticated = false
    state.user = null
  }
}

const actions = {
  updateStatus({ commit }, status) {
    commit('SET_STATUS', status)
  },
  logout({ commit }) {
    commit('LOGOUT')
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}